import { defineStore } from 'pinia'
import { RouteRecordRaw } from 'vue-router'

interface IState {
    routes: RouteRecordRaw[] | [],
    currentNav: string,
    currentPage: number,
    breadCrumbs: string[]
}
const useNavStore = defineStore('nav', {
  persist: true,
  state: ():IState => {
    return {
      routes: [],
      currentNav: '办公',
      currentPage: 0,
      breadCrumbs: []
    }
  },
  actions: {
    setRoutes(routes: RouteRecordRaw[] | []) {
      this.routes = routes
    },
    setCurrentNav(currentNav: string) {
      this.currentNav = currentNav
    },
    setCurrentPage(page: number) {
      this.currentPage = page
    },
    setBreadCrumbs(breadCrumbs: string[]) {
      this.breadCrumbs = breadCrumbs
    }
  },
  getters: {

  }
})

export default useNavStore